#!/usr/bin/env bash

set -eux
__CURRENT__=`pwd`
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}

# 参考
# https://github.com/docker-library/official-images/blob/master/library/nginx
# https://github.com/nginxinc/docker-nginx/blob/master/Dockerfile-alpine.template

mkdir -p nginx-conf/
cd ${__DIR__}/nginx-conf/

# nginx:alpine  是镜像名称

container_id=$(docker create nginx:alpine)  # returns container ID
docker cp $container_id:/etc/nginx/nginx.conf nginx.conf
docker cp $container_id:/etc/nginx/mime.types mime.types
docker cp $container_id:/etc/nginx/conf.d/default.conf default.conf

docker rm $container_id